<template>
  <div>
    <el-form :model="rejectParams" ref="rejectParams" size="normal">
      <el-form-item label="电子政务部审核意见：">
        <el-input v-model="rejectParams.check_advice" type="textarea" :rows="4"></el-input>
      </el-form-item>
      <!-- <el-form-item label="咨询机构审核意见：">
        <el-input v-model="rejectParams.third_check_advice" type="textarea" :rows="4"></el-input>
      </el-form-item> -->
    </el-form>
    <div class="center">
      <el-button type="danger" size="medium" @click="cancel" :loading="loading">取消</el-button>
      <el-button type="primary" size="medium" @click="save" v-if="this.switch" :loading="loading">驳回</el-button>
    </div>
  </div>
</template>
<script>
export default {
  name: 'BidReject',
  components: {

  },
  props: {
    rejectParams: {
      type: Object,
      default: () => {
        return {}
      }
    },
    switch: {
      type: Boolean,
      default: () => {
        return false
      }
    }
  },
  data () {
    return {
      loading: false
    }
  },
  created () {

  },
  mounted () {
  },
  methods: {
    cancel () {
      this.loading = false
      this.$emit('cancel')
    },
    async save () {
      if (!this.rejectParams.check_advice) {
        this.$tips.error('请填写意见')
        return
      }
      this.loading = true
      this.$confirm('是否确认驳回', '提示', {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(async action => {
        const res = await this.$http('blockProjectUp', {
          del_flag: '0',
          id: this.rejectParams.id,
          status: this.rejectParams.status,
          target_status: '2',
          check_status: '2',
          check_advice: this.rejectParams.check_advice
        })
        this.$tips.success(res.errmsg)
        this.loading = false
        this.$emit('cancel');
        this.$emit('init');
      }).catch(() => {

      });

    }
  },
  computed: {

  }
}
</script>
<style lang='scss' scoped>
</style>
